﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FCMS.Entities;

namespace FCMS.Mvc.Controllers.Admin
{
    public class MainController : AdminBaseController
    {
        [AdminAuthorize(IsVerify = false)]
        public ActionResult Login()
        {
            return View();
        }

        [HttpPost]
        [AdminAuthorize(IsVerify = false)]
        public ActionResult Login(string name, string password, string code)
        {
            if (Context.Session["CheckCode"] != null &&
               Context.Session["CheckCode"].ToString().ToLower() != code.ToLower())
            {
                ViewData["Message"] = "验证码错误";
                return View();
            }

            Context.Session["CheckCode"] = null;

            //var User = this.MiddleTier.UserManager.GetUser(name, password);
            //if (User != null)
            //{
            this.SetAuthCookie(new User { UserID = 1, UserName = "faith" }, false);
            return RedirectToAction("Index");
            //}
            //else
            //{
            ViewData["Message"] = "密码或用户名错误";
            return View();
            //}
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Main()
        {
            return View();
        }

        public ActionResult Info()
        {
            return View();
        }
    }
}
